pragma Singleton
import QtQuick 2.0

import QtQuick.Controls.Material 2.12


Item {
    id:root

    property string style
    property color textColor
    property color headerColor
    property color pageColor
    property color controlColor

    //Material
    property color primary
    property color foreground
    property color _background


    QtObject{
        id:night
        property color  textColor: "white"
        property color  headerColor: "#1E1A1A"
        property color  pageColor: "black"
    }
    QtObject{
        id:light
        property color  textColor: "black"
        property color  headerColor: "#F5FFFA"
        property color  pageColor: "white"
    }
    QtObject{
        id:darkGreen
        property color  textColor: "white"
        property color  headerColor: "#696969"
        property color  pageColor: "#4683B4"
    }


    function selectColor(style){
        switch(style){
        case "night":
            root.textColor = night.textColor
            root.headerColor = night.headerColor
            root.pageColor = night.pageColor
            primary = "#141313"
            controlColor = "#10171D"
            foreground = "white"
            _background = "black"
        break;
        case "light":
            root.textColor = light.textColor
            root.headerColor = light.headerColor
            root.pageColor = light.pageColor
            primary = "#C0C0C0"
            controlColor = "#D3D3D3"
            foreground = "black"
            _background = "white"
        break;
        case "darkGreen":
            root.textColor = darkGreen.textColor
            root.headerColor = darkGreen.headerColor
            root.pageColor = darkGreen.pageColor
            primary = "#3CB370"
            controlColor = "#4169E1"
            foreground = "white"
            _background = "green"
        break;
        default:
            root.textColor = night.textColor
            root.headerColor = night.headerColor
            root.pageColor = night.pageColor
            primary = "#141313"
            controlColor = "#10171D"
            foreground = "white"
            _background = "black"
        break;
        }
    }

    onStyleChanged: {
        selectColor(style)
    }

}
